Programming - Fine Tuning

OPENING QUESTIONS: Please take a look at THIS code. The code works well, but there is a *slight* boo boo. Can you find it? (Hint: It isn't in the code per se).

LEARNING TARGET: I will rewrite my leap year program using a 'while' loop during today's class

COURSE DOCUMENT: Ver 1.70 is HERE

WORDS O' THE DAY:

For Loop (Used to move through a loop a certain number of times and keeping track of each time through the loop using a counter variable that is incremented by a specific value each time

While Loop (Used to move through a loop as long as the initial condition is TRUE)

Iterate (To move through a loop, each time through the loop is called one 'iteration')

WORK O' THE DAY

HERE is a revised version, notice the changes!

Let's discuss.

First programming assignment:

One of the VERY first computer 'video' games was something called 'Adventure' or 'IBM Adventure'.

I put that in quotes because there were no video graphics, just plain text.

My friend Ken and I spent many dozens of hours playing that game on his IBM PC with 1 floppy drive that held 160 kb of data.

To play the game you loaded the 'program' disk into the floppy drive and that was then loaded up into the 640Kb of RAM inside the pc.

We then had to load a 'data' disk of our previous efforts so that we could continue playing where we left off.

Game play was simple: Type N to go north, S to go south, E, W, NE, NW, SE, SW as appropriate.

Not all directions worked all the time.

Going N might lead somewhere but going S didn't necessarily get you back to where you started.

All game play will be governed by loops and branches.

If you know how to create functions you can do that but that won't be considered in your grade. You MUST have at least one loop that governs the entire start/stop cycle of the game.

Example:

Start:

System Prompt
You are at the entrance of an abandoned mine. A trail leads to the north and the mine continues south. What do you want to do?
User Command
S
System Prompt
You are inside the mine, it continues to the S and the entrance is to the N
User Command
S
System Prompt
There is a massive dragon guarding the mine. What do you want to do?
User Command
Kill it
System Prompt
You don't have a weapon, what are you going to do, use your bare hands????
User Command
Y
System Prompt
CONGRATULATIONS! You just killed the dragon. Several gold coins fall off its talons.
User Command
Take coins
System Prompt
You have 3 gold coins

 

We spent dozens and dozens of hours on the game and scored 300/301 points. The end of the game "wasn't even remotely fair" (according to the game itself). And it wasn't. Years later I stumbled across the 'solution' online and I was MOST unpleased.

To core 301/301 pts you had to get pulled into the magic room after gaining all objects (we did that). Go to the other side of the room. Pick up a magic wand. Go back to the first part of the room. Drop the magic wand. Go back to the other part of the room. Type BLAST. l (There were no hints at all that such a thing was possible)

SERIOUSLY????

Anywho-- clearly this game can be a time sink, to say the least.

First Steps:

  • Grab an 11 x 17 piece of paper and MAP your game.

  • There should be X number of rooms.

  • Moving back and forth should be inconsistent (sometimes going S after going N works <for example>, and sometimes it doesn't).

  • Not all directions are available from every position.

  • You must complete and turn in your map BEFORE YOU WRITE A SINGLE LINE OF CODE. Be sure and take a picture of your map or somehow make an exact copy. I will use your map to play your game and it must work identically to your map.
  • You can only have 5 rooms connected by 5 passage ways.